package com.project.utils;

import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class SessionFactoryGen {
	/*private static final String resource = "resources/mybatisConfig.xml";*/
	private static SqlSessionFactory sessionFactory = null;

	/**
	 * @return the sessionFactory
	 */
	public static SqlSessionFactory getSessionFactory() {
		return sessionFactory;
	}

	static {
		Reader reader = null;
		try {
			reader = Resources.getResourceAsReader(Constants.batisConfig);
			sessionFactory = new SqlSessionFactoryBuilder().build(reader);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
